<!--
 * @Descripttion:
 * @version:
 * @Author: qinyonglian
 * @Date: 2019-06-12 09:51:32
 * @LastEditors: qinyonglian
 * @LastEditTime: 2021-01-26 13:49:57
 -->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <title>登录页跳转</title>
    <!-- h5plus支持 -->
    <script src="html5plus://ready"></script>
    <script>
        // 处理相对路径地址
      var www = location.href.split('www')[0];
      localStorage.setItem('localPath', www + 'www/');
    </script>
    <script type="text/javascript" src="./static/ux/mui/mui.js"></script>
    <script type="text/javascript" src="./static/ux/je/je.min.js"></script>
    <script>
      /*本页作为登录跳转使用*/

      //基础配置，开发者可以自行配置
      var config = {
        entry: '<%=htmlWebpackPlugin.options.indexConfig.entry%>', //默认打开的插件
        username: '<%=htmlWebpackPlugin.options.indexConfig.username%>', //用户名
        password: '<%=htmlWebpackPlugin.options.indexConfig.password%>',//密码
        serverUrl:'<%=htmlWebpackPlugin.options.indexConfig.proxyServerUrl%>',//代理服务地址
        header: '<%=htmlWebpackPlugin.options.indexConfig.header%>',
        socket: '<%=htmlWebpackPlugin.options.indexConfig.socket%>',
      };

      //手机环境设置访问路径
      if (!mui.os.plus) {
        config.serverUrl = '';
      }
      config.serverUrl = config.serverUrl || '';
      JE.setServerPath(config.serverUrl)
      //打开的首页
      config.index = '/appStatic/'+config.entry+'/index.html';
      JE.ajax({url:'/rbac/login/login',params:{
        j_username: config.username,
        j_password: config.password,
        j_dept: 'default',
        isNew: 1
      }}).then(function(data){
        if (!data.success) { alert(data.message);return;}
        //设置token
        JE.setLSItem('authorization', data.obj);
        //初始化功能数据
        JE.initSysData().then(function(){
            if (window.plus) {
              if(config.socket == 'true'){
                //创建socket
                JE.createSocket(true);
              }
              JE.openWindow({
                url: '_www' + config.index,
                id: 'JE-PLUGIN-IM',
                hideNView: true,
                show: true
              });
            } else {
              window.location.href = config.index;
            }
        });
      });
    </script>
</head>
<body>
  登录页跳转
</body>
</html>
